package uk.ac.cam.juliet.zedcat.socialnetworking;
import java.util.ArrayList;

/**
 *  A class which manages the registration of, clearing of and pushing of updates to plugins.
 *  @author Daniel Wright
 */

public class PluginManager {
	
	ArrayList<AbstractPlugin> l = new ArrayList<AbstractPlugin>();
	
	public synchronized void pushUpdate(String message) {
		for(int i = 0; i<l.size();i++){
			AbstractPlugin plugin = l.get(i);
			plugin.pushUpdate(message);
		}
	}
	
	public synchronized void registerPluginInstance(AbstractPlugin p) {
		l.add(p);
	}
	
	public synchronized void clearPluginInstances() {
		l.clear();
	}
	
}
